home *** CD-ROM | disk | FTP | other *** search
- /* $Id: sphigs.h,v 1.5 1993/03/09 02:00:54 crb Exp $ */
-
- #ifndef SPHIGS_H_INCLUDED_ALREADY
- #define SPHIGS_H_INCLUDED_ALREADY
-
- /* -------------------------------------------------------------------------
- Public SPHIGS include file
- ------------------------------------------------------------------------- */
-
- #include "mat3.h"
- #include "srgp_sphigs.h"
- #include "srgppublic.h"
-
- #ifdef SPHIGS_BOSS
- #define DECLARE
- #else
- #define DECLARE extern
- #endif
-
-
- /* ----------------------------- Constants ------------------------------ */
-
- /* LIMITATION CONSTANTS */
- #define DEFAULT_MAX_STRUCTURE_ID 15
- #define DEFAULT_MAX_VIEW_INDEX 5
- #define DEFAULT_MAX_LIGHT_INDEX 5
- #define DEFAULT_MAX_NAME 32
-
- #define MAX_HIERARCHY_LEVEL 14
-
- DECLARE short MAX_STRUCTURE_ID
- #ifdef SPHIGS_BOSS
- = DEFAULT_MAX_STRUCTURE_ID
- #endif
- ;
- DECLARE short MAX_VIEW_INDEX
- #ifdef SPHIGS_BOSS
- = DEFAULT_MAX_VIEW_INDEX
- #endif
- ;
- DECLARE short MAX_LIGHT_INDEX
- #ifdef SPHIGS_BOSS
- = DEFAULT_MAX_LIGHT_INDEX
- #endif
- ;
- DECLARE short MAX_NAME
- #ifdef SPHIGS_BOSS
- = DEFAULT_MAX_NAME
- #endif
- ;
-
-
- /* RENDERING MODE CONSTANTS */
- #define WIREFRAME_RAW 1
- #define WIREFRAME 2 /* default */
- #define FLAT 3
- #define LIT_FLAT 4
- #define GOURAUD 5
-
- /* NETWORK DELETION TYPES */
- #define UNCONDITIONAL 1
- #define CONDITIONAL 2
-
- /* MATRIX CONCATENATION TYPES */
- #define ASSIGN 1
- #define PRECONCATENATE 2
- #define POSTCONCATENATE 3
-
- /* PROJECTION TYPES */
- #define ORTHOGRAPHIC 0
- #define PERSPECTIVE 1
-
- /* EDGE FLAGS */
- #define EDGE_VISIBLE 0
- #define EDGE_INVISIBLE 1
-
- /* IMPLICIT REGENERATION MODES */
- #define SUPPRESSED 1
- #define ALLOWED 2
-
- /* RENDERING ALGORITHMS */
- #define RENDER_PAINTERS 0
- #define RENDER_BSP 1
-
-
- #include "elementType.h"
-
-
- /* ------------------------------- Types -------------------------------- */
-
- /* 2D */
- typedef struct { double x, y; } NDC_point;
- typedef struct { NDC_point bottom_left, top_right; } NDC_rectangle;
-
- /* 3D */
- typedef MAT3vec point;
- typedef MAT3vec vector;
- typedef MAT3mat matrix;
-
- typedef short vertex_index;
-
- typedef
- struct {
- point position;
- int view_index;
- int button_chord[3];
- int button_of_last_transition;
- } locator_measure;
- #define viewIndex view_index
- #define locatorMeasure locator_measure
-
- typedef
- struct {
- int structureID;
- int elementIndex;
- int elementType; /* symbolic constants in elementType.h */
- int pickID;
- } pickPathItem;
-
- typedef pickPathItem pickPath[MAX_HIERARCHY_LEVEL];
-
- typedef struct {
- int pickLevel;
- pickPath path;
- } pickInformation;
-
- typedef char name; /* a number from 1 to 32 */
-
- /* ------------------------------- Macros ------------------------------- */
-
- #define SPH_beep SRGP_beep
-
- #define SPH_setModXform(A, B) \
- A, SPH_setModelingTransformation (temp_matrix, B)
-
- /*
- * NOTE: in the original release of SPHIGS, the vector package used performed
- * multiplications using row instead of column vectors, the result being that in
- * order to use SPH_compose on transform matrices generated by SPHIGS, one had
- * to multiply them in reverse order to make composite transforms.
- * Oddly enough, this was deemed counterintuitive, and SPH_compose has
- * been replaced by SPH_composeMatrix, which multiplies transforms correctly (as
- * described in the text), and the vector package now treats matrix mults as
- * column vectors (also as found in the text).
- * SPH_oldComposeMatrix is provided here for the sake of backward
- * compatibility, and the following macro ensures that programs written with the
- * original (beta) version of SPHIGS will compile and work as intended.
- *
- */
- #define SPH_compose SPH_oldComposeMatrix
-
- /* ----------------------------- Prototypes ----------------------------- */
-
- /* In sph_state.c: */
- void SPH_begin (int width, int height, int color_planes_desired,
- int shades_per_flexicolor);
- void SPH_end (void);
- void SPH_setMaxStructureID (int);
- void SPH_setMaxNameID (int);
- void SPH_setMaxViewIndex (int);
- void SPH_setMaxLightSourceIndex (int);
-
- /* In sph_utility.c: */
- double * SPH_defPoint (double *pt, double x, double y, double z);
- NDC_rectangle SPH_defNDCrectangle
- (double lx, double by, double rx, double ty);
-
- /* In sph_filter.c: */
- /* unimplemented */ void SPH_addToHiliteFilter (int viewID, name);
- /* unimplemented */ void SPH_removeFromHiliteFilter (int viewID, name);
- void SPH_addToInvisFilter (int viewID, name);
- void SPH_removeFromInvisFilter (int viewID, name);
-
- /* In sph_element.c: */
- void SPH_addToNameSet (name);
- void SPH_removeFromNameSet (name);
-
- void SPH_polyhedron (int numverts, int numfacets,
- point *verts, vertex_index *facets);
- void SPH_fillArea (int vCount, point *vertices);
- void SPH_polyMarker(int vCount, point *vertices);
- void SPH_polyLine (int vCount, point *vertices);
- void SPH_text (point origin, char *string);
-
- void SPH_setInteriorColor (int value);
- void SPH_setLineStyle (int LINE_STYLE);
- void SPH_setLineColor (int value);
- void SPH_setLineWidthScaleFactor (double value);
- void SPH_setEdgeFlag (int value);
- void SPH_setEdgeStyle (int LINE_STYLE);
- void SPH_setEdgeColor (int value);
- void SPH_setEdgeWidthScaleFactor (double value);
- void SPH_setMarkerStyle (int MARKER_STYLE);
- void SPH_setMarkerColor (int value);
- void SPH_setMarkerSizeScaleFactor (double value);
- void SPH_setTextFont (int value);
- void SPH_setTextColor (int value);
-
- void SPH_setModelingTransformation (matrix, int method);
- void SPH_clearModelingTransformation (void);
- void SPH_label (int);
- void SPH_setPickIdentifier (int);
- void SPH_executeStructure (int structID);
-
- /* In sph_post.c: */
- void SPH_postRoot (int structID, int viewID);
- void SPH_unpostRoot (int structID, int viewID);
- void SPH_unpostAllRoots (int viewID);
-
- /* In sph_edit.c: */
- void SPH_openStructure (int structID);
- void SPH_closeStructure (void);
-
- void SPH_copyStructure (int structID);
-
- void SPH_setElementPointer (int elptr);
- int SPH_inquireElementPointer (void);
- void SPH_offsetElementPointer (int offset);
- void SPH_moveElementPointerToLabel (int label);
-
- void SPH_deleteElement (void);
- void SPH_deleteElementsInRange (int index1, int index2);
- void SPH_deleteElementsBetweenLabels (int lab1, int lab2);
-
- /* In sph_refresh.c: */
- void SPH_setDoubleBufferingFlag (boolean);
- void SPH_setRenderingMode (int viewindex, int value);
- void SPH_setImplicitRegenerationMode (int mode);
- void SPH_regenerateScreen (void);
-
- /* In sph_view.c: */
- void SPH_evaluateViewOrientationMatrix
- (point view_ref_point,
- vector view_plane_normal,
- vector view_up_vector,
- matrix vo_matrix /*varparm*/ );
-
- void SPH_evaluateViewMappingMatrix
- (double umin, double umax,
- double vmin, double vmax,
- int proj_type, /* ORTHOGRAPHIC or PERSPECTIVE */
- point proj_ref_point,
- double front_plane_dist,
- double back_plane_dist,
- double vp_minx, double vp_maxx,
- double vp_miny, double vp_maxy,
- double vp_minz, double vp_maxz,
- matrix vm_matrix /*varparm*/ );
-
- void SPH_setViewRepresentation
- (int viewIndex,
- matrix vo_matrix,
- matrix vm_matrix,
- double vp_minx, double vp_maxx,
- double vp_miny, double vp_maxy,
- double vp_minz, double vp_maxz);
-
- void SPH_enableView (int viewIndex);
- void SPH_disableView (int viewIndex);
-
- void SPH_setViewBackgroundColor (int viewIndex, int color);
- void SPH_setViewRenderAlgorithm (int viewIndex, int algorithm);
-
- void SPH_setViewPointLightSource (int viewIndex,
- double u, double v, double n);
- void SPH_addPointLightSource (int viewIndex, int lightIndex,
- point position, boolean cameraRelative,
- double intensity, double attenuation);
- void SPH_removePointLightSource (int viewIndex, int lightIndex);
-
-
- /* In sph_input.c: */
- #define SPH_setInputMode SRGP_setInputMode
- #define SPH_waitEvent SRGP_waitEvent
- #define SPH_getKeyboard SRGP_getKeyboard
- #define SPH_sampleKeyboard SRGP_sampleKeyboard
- #define SPH_setKeyboardProcessingMode SRGP_setKeyboardProcessingMode
- #define SPH_setKeyboardEchoColor SRGP_setKeyboardEchoColor
- #define SPH_setKeyboardEchoFont SRGP_setKeyboardEchoFont
- #define SPH_setKeyboardMeasure SRGP_setKeyboardMeasure
- #define SPH_setLocatorEchoCursorShape SRGP_setLocatorEchoCursorShape
- #define SPH_setLocatorButtonMask SRGP_setLocatorButtonMask
-
- void SPH_getLocator (locator_measure*);
- void SPH_sampleLocator (locator_measure*);
- void SPH_setLocatorMeasure (point position);
- void SPH_setKeyboardEchoOrigin (point position);
-
- void SPH_pickCorrelate (point npc_position, int viewindex,
- pickInformation *pickinfo);
-
- /* In sph_modxform.c: */
- void SPH_scale (double x, double y, double z, matrix result);
- void SPH_rotateX (double angle, matrix result);
- void SPH_rotateY (double angle, matrix result);
- void SPH_rotateZ (double angle, matrix result);
- void SPH_translate (double x, double y, double z, matrix result);
- void SPH_oldComposeMatrix (matrix m1, matrix m2, matrix result);
- void SPH_composeMatrix (matrix m1, matrix m2, matrix result);
-
- /* In sph_attrib.c: */
- #define SPH_loadFont SRGP_loadFont
-
- void SPH_loadCommonColor (int microcolorindex, char *name);
-
-
- /* ---------------------------- End of File ----------------------------- */
-
- #endif /* SPHIGS_H_INCLUDED_ALREADY */
-
- #undef DECLARE
-